﻿namespace HRM.CORE.REPORT
{
    using APP.HELPER.Utils.Security;
    using DevExpress.Utils;
    using DevExpress.XtraPrinting;
    using DevExpress.XtraReports.UI;
    using HRM.CORE;
    using System; using Extra.ERP;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Drawing.Printing;

    public class rptContract3 : XtraReport
    {
        private BottomMarginBand BottomMargin;
        private IContainer components = null;
        private DetailBand Detail;
        private HRM_CONTRACT l_Contract = new HRM_CONTRACT();
        private string m_ContractCode = "";
        private string m_EmployeeCode = "";
        private TopMarginBand TopMargin;
        private XRTableCell txtCompany;
        private XRTableCell txtContractCode;
        private XRRichText xrContractDetail;
        private XRTable xrTable1;
        private XRTable xrTable2;
        private XRTableCell xrTableCell1;
        private XRTableCell xrTableCell2;
        private XRTableCell xrTableCell3;
        private XRTableCell xrTableCell4;
        private XRTableRow xrTableRow1;
        private XRTableRow xrTableRow2;
        private XRTableRow xrTableRow3;

        public rptContract3(string ContractCode, string EmployeeCode)
        {
            this.InitializeComponent();
            this.m_ContractCode = ContractCode;
            this.m_EmployeeCode = EmployeeCode;
            this.LoadData();
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void InitializeComponent()
        {
            ComponentResourceManager manager = new ComponentResourceManager(typeof(rptContract3));
            this.Detail = new DetailBand();
            this.xrTable2 = new XRTable();
            this.xrTableRow2 = new XRTableRow();
            this.txtCompany = new XRTableCell();
            this.xrTableCell2 = new XRTableCell();
            this.xrTableRow3 = new XRTableRow();
            this.txtContractCode = new XRTableCell();
            this.xrTableCell4 = new XRTableCell();
            this.xrTable1 = new XRTable();
            this.xrTableRow1 = new XRTableRow();
            this.xrTableCell1 = new XRTableCell();
            this.xrTableCell3 = new XRTableCell();
            this.xrContractDetail = new XRRichText();
            this.TopMargin = new TopMarginBand();
            this.BottomMargin = new BottomMarginBand();
            this.xrTable2.BeginInit();
            this.xrTable1.BeginInit();
            this.xrContractDetail.BeginInit();
            this.BeginInit();
            this.Detail.Controls.AddRange(new XRControl[] { this.xrTable2, this.xrTable1, this.xrContractDetail });
            this.Detail.HeightF = 771f;
            this.Detail.Name = "Detail";
            this.Detail.Padding = new PaddingInfo(0, 0, 0, 0, 100f);
            this.Detail.TextAlignment = TextAlignment.TopLeft;
            this.xrTable2.Font = new Font("Times New Roman", 9.75f, FontStyle.Bold);
            this.xrTable2.LocationFloat = new PointFloat(3.125f, 0f);
            this.xrTable2.Name = "xrTable2";
            this.xrTable2.Rows.AddRange(new XRTableRow[] { this.xrTableRow2, this.xrTableRow3 });
            this.xrTable2.SizeF = new SizeF(686.9999f, 51.04167f);
            this.xrTable2.StylePriority.UseFont = false;
            this.xrTableRow2.Cells.AddRange(new XRTableCell[] { this.txtCompany, this.xrTableCell2 });
            this.xrTableRow2.Name = "xrTableRow2";
            this.xrTableRow2.Weight = 1.0;
            this.txtCompany.Name = "txtCompany";
            this.txtCompany.Padding = new PaddingInfo(0, 0, 0, 0, 100f);
            this.txtCompany.StylePriority.UsePadding = false;
            this.txtCompany.StylePriority.UseTextAlignment = false;
            this.txtCompany.Text = "txtCompany";
            this.txtCompany.TextAlignment = TextAlignment.MiddleLeft;
            this.txtCompany.Weight = 1.7617004227970863;
            this.xrTableCell2.Name = "xrTableCell2";
            this.xrTableCell2.StylePriority.UseTextAlignment = false;
            this.xrTableCell2.Text = "CỘNG H\x00d2A X\x00c3 HỘI CHỦ NGHĨA VIỆT NAM";
            this.xrTableCell2.TextAlignment = TextAlignment.MiddleCenter;
            this.xrTableCell2.Weight = 1.2382995772029137;
            this.xrTableRow3.Cells.AddRange(new XRTableCell[] { this.txtContractCode, this.xrTableCell4 });
            this.xrTableRow3.Name = "xrTableRow3";
            this.xrTableRow3.Weight = 1.0416667175292968;
            this.txtContractCode.Font = new Font("Times New Roman", 9.75f, FontStyle.Bold);
            this.txtContractCode.Name = "txtContractCode";
            this.txtContractCode.Padding = new PaddingInfo(0, 0, 0, 0, 100f);
            this.txtContractCode.StylePriority.UseFont = false;
            this.txtContractCode.StylePriority.UsePadding = false;
            this.txtContractCode.StylePriority.UseTextAlignment = false;
            this.txtContractCode.Text = "Số: [ContractCode]";
            this.txtContractCode.TextAlignment = TextAlignment.MiddleLeft;
            this.txtContractCode.Weight = 1.7617001927409941;
            this.xrTableCell4.Multiline = true;
            this.xrTableCell4.Name = "xrTableCell4";
            this.xrTableCell4.StylePriority.UseTextAlignment = false;
            this.xrTableCell4.Text = "\tĐộc lập - Tự do - Hạnh ph\x00fac";
            this.xrTableCell4.TextAlignment = TextAlignment.MiddleLeft;
            this.xrTableCell4.Weight = 1.2382998072590059;
            this.xrTable1.Font = new Font("Times New Roman", 12f, FontStyle.Bold);
            this.xrTable1.LocationFloat = new PointFloat(3.125f, 651.875f);
            this.xrTable1.Name = "xrTable1";
            this.xrTable1.Rows.AddRange(new XRTableRow[] { this.xrTableRow1 });
            this.xrTable1.SizeF = new SizeF(686.9999f, 78.125f);
            this.xrTable1.StylePriority.UseFont = false;
            this.xrTableRow1.Cells.AddRange(new XRTableCell[] { this.xrTableCell1, this.xrTableCell3 });
            this.xrTableRow1.Name = "xrTableRow1";
            this.xrTableRow1.Weight = 1.0;
            this.xrTableCell1.Multiline = true;
            this.xrTableCell1.Name = "xrTableCell1";
            this.xrTableCell1.StylePriority.UseTextAlignment = false;
            this.xrTableCell1.Text = "ĐẠI DIỆN B\x00caN A\r\n(K\x00fd & ghi r\x00f5 họ t\x00ean)";
            this.xrTableCell1.TextAlignment = TextAlignment.TopCenter;
            this.xrTableCell1.Weight = 1.78281264922504;
            this.xrTableCell3.Multiline = true;
            this.xrTableCell3.Name = "xrTableCell3";
            this.xrTableCell3.StylePriority.UseTextAlignment = false;
            this.xrTableCell3.Text = "ĐẠI DIỆN B\x00caN B\r\n(K\x00fd & ghi r\x00f5 họ t\x00ean)";
            this.xrTableCell3.TextAlignment = TextAlignment.TopCenter;
            this.xrTableCell3.Weight = 1.7890621033509779;
            this.xrContractDetail.Font = new Font("Times New Roman", 11.25f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.xrContractDetail.LocationFloat = new PointFloat(3.125f, 68.08334f);
            this.xrContractDetail.Name = "xrContractDetail";
            this.xrContractDetail.SerializableRtfString = manager.GetString("xrContractDetail.SerializableRtfString");
            this.xrContractDetail.SizeF = new SizeF(686.9999f, 576.0417f);
            this.xrContractDetail.StylePriority.UseFont = false;
            this.TopMargin.HeightF = 54f;
            this.TopMargin.Name = "TopMargin";
            this.TopMargin.Padding = new PaddingInfo(0, 0, 0, 0, 100f);
            this.TopMargin.TextAlignment = TextAlignment.TopLeft;
            this.BottomMargin.HeightF = 50f;
            this.BottomMargin.Name = "BottomMargin";
            this.BottomMargin.Padding = new PaddingInfo(0, 0, 0, 0, 100f);
            this.BottomMargin.TextAlignment = TextAlignment.TopLeft;
            base.Bands.AddRange(new Band[] { this.Detail, this.TopMargin, this.BottomMargin });
            base.Margins = new Margins(0x5d, 0x42, 0x36, 50);
            base.Version = "9.3";
            this.BeforePrint += new PrintEventHandler(this.rptContract3_BeforePrint);
            this.xrTable2.EndInit();
            this.xrTable1.EndInit();
            this.xrContractDetail.EndInit();
            this.EndInit();
        }

        private void LoadData()
        {
            DataSet set = new DataSet();
            DataTable listByContract = new DataTable();
            listByContract = this.l_Contract.GetListByContract(this.m_ContractCode, this.m_EmployeeCode);
            set.Tables.Add(listByContract);
            base.DataSource = set;
            base.DataMember = listByContract.TableName;
            base.DataAdapter = listByContract;
        }

        private void rptContract3_BeforePrint(object sender, PrintEventArgs e)
        {
            ////if (MyInfo.Get(MyEncryption.Encrypt("ERP01", "123654", true)) == "OK")
            {
                this.txtCompany.Text = "";//MyInfo.Company.ToUpper();
            }
        }
    }
}

